The COM CreateObject method creates an instance of an underlying IDL object and calls its Init method with any specified parameters (see CreateObject for details). Through this object instance, you have access to the properties and methods of the object as well as the underlying IDL process.
The following samples rely upon an IDL object named idlexfoo__define.pro containing the following code:
; The Init method expects three parameters:
; a string, a 32-bit long, and an array which has
; 2 rows & 3 columns, containing 32-bit long values.
; The ::Init method can also be called without any parameters.
FUNCTION idlexfoo::Init, parmStr, parmVal, parmArr, _EXTRA=e
IF (N_ELEMENTS(parmStr) EQ 1) THEN BEGIN
IF ( SIZE(parmStr,/type) NE 7 ) THEN BEGIN
PRINT, 'IDLexFoo::Init, parmStr is not a STRING' HELP, parmStr
RETURN, 0
ENDIF
ENDIF
IF (N_ELEMENTS(parmVal) EQ 1) THEN BEGIN
IF ( (SIZE(parmVal,/type) NE 3) ) THEN BEGIN PRINT, 'IDLexFoo::Init, parmVal is not a LONG' HELP, parmVal
RETURN, 0
ENDIF
ENDIF
nElms = N_ELEMENTS(parmArr)
IF (nElms GT 0) THEN BEGIN
IF ( (nElms NE 6) OR (size(parmArr,/type) NE 3) ) THEN BEGIN PRINT, 'IDLexFoo::Init, parmArr is not a ARR(3,2) of LONG)'
HELP, parmArr
RETURN, 0
ENDIF
ENDIF
RETURN, 1
END
; Object definition.
PRO idlexfoo define
; Create [col, row] 32-bit long array.
initArr = LONARR(3, 2)
struct = {idlexfoo, $
parmStr: '', $
parmVal: 0L, $
parmArr: initArr}
END
You will need to create the necessary wrapper object files by using the Export Bridge Assistant to generate them. Once you have created the object definition file, idlexfoo__define.pro, complete the following steps:
The top-level project entry in the left tree panel is selected by default. There is no need to modify the default properties shown in the right-hand property panel, but you can enter different values if desired. There are no other parameters that need to be defined for this object.
|
Tree View Item |
Parameter Configuration |
|---|---|
|
IDL Export Bridge Project |
Accept the default value or make changes as desired:
|
|
helloworldex |
Drawable object equals False |
See the language-specific sections for information on how to create this object in your application: